import {ref, reactive} from 'vue'
import {getSubRefGroup} from "@/api/group";

export default function() {
  const groupList = ref([])
  const groupsOptions = reactive({})
  const groupid_list = ref([])
  getSubRefGroup().then(response => {
    groupList.value = response.data
    response.data.forEach(group => {
      groupsOptions[group.groupid] = group.name
      groupid_list.value.push(group.groupid)
    })
  })
  return {
    groupList,
    groupsOptions,
    groupid_list
  }
}
